package ThreadDemo.src;

/*
 * Author: JacksonCoder
 * FileName: checkInterruptStatus
 * Version: 1.0.0
 */
public class checkInterruptStatus {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new ThreadA();
        t.start();
        Thread.sleep(1); // 暂停1秒
        t.interrupt(); // 打断t线程
        t.join(); // 等待t线程结束
        System.out.println("====== end ======");
    }
}

class ThreadA extends Thread{

    public void run(){
        int n = 0;
        while(!isInterrupted()){
            n ++;
            System.out.println(n + " hello !");
        }
    }
}
